<script src="client-api.js"></script>
<script>
// You must copy client-api.js to the same folder as this page. Check the console for output.

  var config = {
    commandHost: "https://cmd.nqminds.com",
    queryHost: "https://q.nqminds.com"  
  };

  var nqmindsTDX = new TDXApi(config);

  // Authenticate using token id and secret (from the toolbox)
  nqmindsTDX.authenticate("BJeMKwDUT","12345", function(err, accessToken) {
    if (err) {
      console.log(err);
    }
    else {
      nqmindsTDX.getDataset("SJx-IgF8a", function(err,data) {
        if (err) console.log(err);
        else console.log(data);

      });

      nqmindsTDX.getAggregateData("BkWqQQuBo", '[{"$match":{"parent_id":"E09000001"}},{"$group":{"_id":null,"id_array":{"$push":"$child_id"}}}]', {limit: 1000},  function(err,data) {
        if (err) console.log(err);
        else console.log(data);

      });

      nqmindsTDX.getDatasets({"schemaDefinition.basedOn": "PlanningPoplet"}, null, {limit: 1000},  function(err,data) {
        if (err) console.log(err);
        else console.log(data);

      });
    }  
  });
</script>